package com.hcq.controller;

import com.common.annotation.RequireRoles;
import com.common.entity.Rsp;
import com.common.entity.Scenic;
import com.common.entity.Ticket;
import com.hcq.service.TicketServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TicketController {

    @Autowired
    TicketServiceImpl ticketService;

    @PostMapping("/addMany")
    @RequireRoles(roles = {"admin","super_admin"},index = 2)
    public Rsp addMany(@RequestBody Scenic scenic,
                       @RequestHeader(value = "userId") String userId, @RequestHeader(value = "roleSign") String roleSign){
        System.out.println(scenic.getTickets());
        return ticketService.addMany(scenic.getTickets(),userId);
    }
}
